docs: update README, examples, and docs for recent API features#21
Merged
tirthpatell merged 3 commits intomainfrom Mar 13, 2026
Merged
docs: update README, examples, and docs for recent API features#21tirthpatell merged 3 commits intomainfrom
tirthpatell merged 3 commits intomainfrom
Conversation
- Add missing features to README: GIF posts, ghost posts, reply approvals, ContainerBuilder, IsTransientError - Fix incorrect code examples: ExchangeCodeForToken and GetLongLivedToken missing ctx param, GetUserPosts using wrong options type - Mark library as unofficial/not affiliated with Meta - Add Go version compatibility note (1.21-1.24) - Fix examples: non-existent QuotePostContent type, wrong CreateQuotePost and RepostPost signatures, wrong env var name in .env.example - Add GIF, ghost post, and reply approval examples - Scope CI coverage to library package only (34.8% -> 51.3%) - Update LICENSE copyright to 2024-present - Add race detector command to CONTRIBUTING.md
Greptile SummaryThis PR fixes several concrete bugs in the documentation and examples — incorrect function signatures, non-existent types, and wrong environment variable names — and adds documentation for newer API features (GIF posts, ghost posts, reply approvals, Key fixes verified correct:
CI change: Style observations:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User reads README or examples] --> B{Which API feature?}
B --> C[Post Creation]
B --> D[GIF Posts]
B --> E[Ghost Posts]
B --> F[Reply Approvals]
B --> G[ContainerBuilder]
C --> C1["CreateTextPost(ctx, &TextPostContent{...})"]
C --> C2["CreateImagePost / CreateVideoPost / CreateCarouselPost"]
C --> C3["CreateTextPost with QuotedPostID for quotes"]
C --> C4["RepostPost(ctx, threads.PostID(...))"]
D --> D1["TextPostContent{ GIFAttachment: &GIFAttachment{GIFID, GIFProviderGiphy} }"]
E --> E1["TextPostContent{ IsGhostPost: true }"]
E --> E2["GetUserGhostPosts(ctx, userID, nil)"]
F --> F1["TextPostContent{ EnableReplyApprovals: true }"]
F --> F2["ApprovePendingReply(ctx, PostID)"]
F --> F3["IgnorePendingReply(ctx, PostID)"]
G --> G1["NewContainerBuilder()"]
G1 --> G2[".SetMediaType / .SetText / .SetReplyControl / ..."]
G2 --> G3[".Build() → url.Values"]
Prompt To Fix All With AIThis is a comment left during a code review.
Path: examples/post-creation/main.go
Line: 294
Comment:
**Unused named parameter inconsistent with existing pattern**
`createGIFPost` (and `createGhostPost` below) accept a named `client *threads.Client` parameter that is never referenced in the function body. Every other dry-run function in this file uses `_ *threads.Client` to signal intentional non-use:
- `createCarouselPost(_ *threads.Client)` (line 200)
- `createQuotePost(_ *threads.Client)` (line 240)
- `createRepost(_ *threads.Client)` (line 271)
While Go does not produce a compile error for unused function parameters, the inconsistency breaks the established convention in the file and could confuse readers who expect the `client` variable to be used somewhere. The same applies to `createGhostPost` at line 323.
```suggestion
func createGIFPost(_ *threads.Client) {
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: examples/post-creation/main.go
Line: 323
Comment:
**Unused named parameter inconsistent with existing pattern**
Same issue as `createGIFPost`: the `client` parameter is named but never used. For consistency with the other dry-run helpers in this file, it should be replaced with the blank identifier.
```suggestion
func createGhostPost(_ *threads.Client) {
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: README.md
Line: 215
Comment:
**Raw string instead of exported constant**
`SetMediaType("TEXT")` passes a magic string that readers must know matches the library's internal expectation. The library exports `threads.MediaTypeText` (and `threads.MediaTypeImage`, `threads.MediaTypeVideo`, `threads.MediaTypeCarousel`) in `constants.go` specifically to avoid this pattern. Using the constant also makes the example self-consistent with how the library is used internally (e.g., in `container_builder.go`).
```suggestion
builder := threads.NewContainerBuilder().
SetMediaType(threads.MediaTypeText).
```
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 799f568 |
- NewContainerBuilder() takes no arguments, remove erroneous userID param - ReplyControlFollowing does not exist, use ReplyControlFollowersOnly
Prevents integration tests from running without credentials when contributors follow the setup instructions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
QuotePostContenttype, wrongCreateQuotePost/RepostPostsignatures, wrong env var in.env.example; add GIF, ghost post, and reply approval examples-coverpkg(fixes badge: 34.8% -> 51.3%)go test -racecommandBugs fixed in docs
README.mdExchangeCodeForToken/GetLongLivedTokenmissingctxparamREADME.mdGetUserPostsusingPostsOptionsinstead ofPaginationOptionsexamples/basic-usage/main.goQuotePostContenttypeexamples/post-creation/main.goCreateQuotePost(content)signatureexamples/post-creation/main.goRepostPost(postIDToRepost)signatureexamples/.env.exampleDEBUGinstead ofTHREADS_DEBUGTest plan
go build ./examples/...go test -short -race -coverpkg=github.com/tirthpatell/threads-go ./...